package booyah.web;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.ui.Model;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpSession;

import booyah.service.EventService;

@Controller
@RequestMapping("/home")
public class HomeController {

    private EventService eventService;

    @Autowired
    public void setEventService(EventService eventService) {
        this.eventService = eventService;
    }

    @RequestMapping(method = RequestMethod.GET)
    public String prepareItemList(Model model, HttpSession session) {
        model.addAttribute("items", eventService.findAllEvents());
        return "home";
    }

//    private AuctionUser getAuctionUser(HttpSession session) {
//        return (AuctionUser) session.getAttribute("user");
//    }
}
